package org.jeecg.modules.nikeProject.controller;

import javax.servlet.http.HttpServletRequest;

import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.common.system.util.JwtUtil;
import org.jeecg.modules.nikeProject.entity.SportsProjectSupplementary;
import org.jeecg.modules.nikeProject.entity.vo.SupplementaryReqVO;
import org.jeecg.modules.nikeProject.service.ISportsProjectSupplementaryService;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.system.base.controller.JeecgController;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

 /**
 * @Description: 案例补充材料
 * @Author: jeecg-boot
 * @Date:   2025-06-17
 * @Version: V1.0
 */
@Slf4j
@Api(tags="案例补充材料")
@RestController
@RequestMapping("/ps")
public class SportsProjectSupplementaryController extends JeecgController<SportsProjectSupplementary, ISportsProjectSupplementaryService> {
	@Autowired
	private ISportsProjectSupplementaryService sportsProjectSupplementaryService;
	/**
	 * 添加
	 * @param sportsProjectSupplymentary
	 * @return
	 */
	@AutoLog(value = "案例补充材料-添加")
	@ApiOperation(value="案例补充材料-添加", notes="案例补充材料-添加")
	@PostMapping(value = "/add")
	public Result<?> add(@RequestBody SupplementaryReqVO sportsProjectSupplymentary, HttpServletRequest req) {
		String username = JwtUtil.getUserNameByToken(req);
		sportsProjectSupplementaryService.add(sportsProjectSupplymentary, username);
		return Result.OK("添加成功！");
	}

	@AutoLog(value = "获取案例补充材料")
	@ApiOperation(value="获取案例补充材料", notes="获取案例补充材料")
	@GetMapping(value = "/getSupplementaryDetail")
	public Result<SupplementaryReqVO> getSupplementaryDetail(HttpServletRequest req) {
		String username = JwtUtil.getUserNameByToken(req);
		return sportsProjectSupplementaryService.getSupplementaryDetail(username);
	}

	@AutoLog(value = "案例补充材料-提交")
	@ApiOperation(value="案例补充材料-提交", notes="案例补充材料-提交")
	@GetMapping(value = "/submit")
	public Result<?> submit(HttpServletRequest req) {
		String username = JwtUtil.getUserNameByToken(req);
		sportsProjectSupplementaryService.submit(username);
		return Result.OK("提交成功！");
	}

 }
